<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8" />
    <title>13_Web Workers-基本使用</title>
</head>

<body>
    <script>
        console.log(1111);


        // 耗时
        // function fib(n) {
        //     if (n <= 2) {
        //         return 1;
        //     }
        //     return fib(n - 1) + fib(n - 2);
        // }

        // var result = fib(45);
        // console.log(result);

        var worker = new Worker('./js/13_Web Workers-基本使用.js');
        worker.postMessage(45);

        worker.onmessage = function(event){
            console.log(event.data);
        }

        console.log(22222);
    </script>
</body>

</html>